<extend name="Public/base"/>

<block name="body">
<!-- 导入css样式 -->
    <link rel="stylesheet" href="__PUBLIC__/Admin/css/mymember.css">

    <div class="main-title">
        <h2>会员详情列表</h2>
    </div>
    <div class="cf">
        <p style="float:left;">
            <a href="{:U('MyMemberDetail/Userlist',array('sort'=>'asc'))}" class="btn">ID正向排序</a>
            <a href="{:U('MyMemberDetail/Userlist',array('sort'=>'desc'))}" class="btn">ID逆向排序</a>
        </p>
        <div class="search-form fr cf">
            <div class="sleft">
                <input type="text" name="real_name" class="search-input" value="{:I('real_name')}" placeholder="请输入会员ID|真实姓名">
                <a class="sch-btn" href="javascript:;" id="search" url="{:U('MyMemberDetail/userlist')}"><i class="btn-search"></i></a>
            </div>
        </div>
    </div>

    <div class="data-table table-striped">
        <form class="ids">
            <table>
                <thead>
                    <tr>
                        <th class="row-selected">
                            <input class="checkbox check-all" type="checkbox">
                        </th>
                        <th>ID</th>
                        <th>会员ID</th>
                        <th>性别</th>
                        <th>电话</th>
                        <th>邮箱</th>
                        <th>真实姓名</th>
                        <th>年龄</th>
                        <th>注册时间</th>
                        <th>收货地址</th>
                    </tr>
                </thead>
                <tbody>
				<notempty name="list">
                <volist name="list" id="val">
                    <tr>
                        <td>
                            <input class="ids row-selected" type="checkbox" name="id[]" value="{$val.id}">
                        </td>
                        <td>{$val.id}</td>
                        <td><a href="{:U('MyMember/userlist?user_id='.$val['user_id'])}">{$val.user_id}</a></td>
                        <td>{$val.sex}</td>
                        <td>{$val.tel}</td>
                        <td>{$val.email}</td>
                        <td>{$val.real_name}</td>
                        <td>{$val.age}</td>
                        <td>{$val.ctime}</td>
                        <td>
                          <a href="{:U('MyMemberAddr/addrlist?user_id='.$val['user_id'])}">详细地址</a>
                          <a href="{:U('Order/orderlist?user_id='.$val['user_id'])}">用户订单</a>
                        </td>
                    </tr>
                </volist>
				<else/>
				<td colspan="10" class="text-center"> aOh! 暂时还没有内容! </td>
				</notempty>
                </tbody>
            </table>
        </form>
        <!-- 分页 -->
        <div class="page">
            {$_page}
        </div>
    </div>
</block>

<block name="script">
    <script type="text/javascript">
        $(function() {
            //搜索功能
            $("#search").click(function() {
                var url = $(this).attr('url');
                var query = $('.search-form').find('input').serialize();
                query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
                query = query.replace(/^&/g, '');
                if (url.indexOf('?') > 0) {
                    url += '&' + query;
                } else {
                    url += '?' + query;
                }
                window.location.href = url;
            });
            //回车搜索
            $(".search-input").keyup(function(e) {
                if (e.keyCode === 13) {
                    $("#search").click();
                    return false;
                }
            });
            //导航高亮
            highlight_subnav('{:U('MyMemberDetail/Userlist')}');
            //点击排序
        	$('.list_sort').click(function(){
        		var url = $(this).attr('url');
        		var ids = $('.ids:checked');
        		var param = '';
        		if(ids.length > 0){
        			var str = new Array();
        			ids.each(function(){
        				str.push($(this).val());
        			});
        			param = str.join(',');
        		}

        		if(url != undefined && url != ''){
        			window.location.href = url + '/ids/' + param;
        		}
        	});
        });

        //状态操作
        $("status").css("border","1px solid red");
    </script>
</block>
